package com.cn.jx.common.enumType;

import java.util.ArrayList;
import java.util.List;

import com.cn.jx.manager.po.DataGrid;
import com.jx.enumType.DataGrideTypeEnum;
import com.jx.enumType.SwitchEnum;

/**
 * 
 * @author 姜旭
 * @version v1.11.20.2019
 * @since 
 * <p>创建时间：2019年12月11日
 * <p>功能描述：
 * <p>官方网站：management/admin/index
 * <p>邮箱地址：524577360@qq.com
 */
public enum RoleGridEnum {
	
	ROLE_NAME("roleName","角色名",70,"center","center","true",1),
	ROLE_CODE("roleCode","角色编码",40,"center","center","true",2),
	DESCRB("descrb","角色描述",120,"center","left","false",3),
	CREATE_TIME("createTime","创建时间",50,"center","center","true",4)
	;
	
	private String field;
	private String text;
	private Integer width;
	private String halign;
	private String align;
	private String sortable;
	private String formatter;
	private int index;
	
	private RoleGridEnum(String field,String text,Integer width,String halign,String align,String sortable,int index,String ... formatter) {
		this.field=field;
		this.width=width;
		this.text=text;
		this.halign=halign;
		this.align=align;
		this.sortable=sortable;
		this.index=index;
		if(formatter!=null && formatter.length>0){
			this.formatter=formatter[0];
		}
	}
	
	public static List<DataGrid> getAllEnum(DataGrideTypeEnum typeEnum,List<String> fieldList){
		List<DataGrid> st=new ArrayList<DataGrid>();
		for (RoleGridEnum sde : RoleGridEnum.values()) {
			if(!fieldList.contains(sde.field)){
				DataGrid mp=DataGrid.getInstance();
				mp.setField(sde.field);
				mp.setText(sde.text);
				mp.setWidth(String.valueOf(sde.width));
				mp.setHalign(sde.halign);
				mp.setAlign(sde.align);
				mp.setSortable(sde.sortable);
				mp.setFormatter(sde.formatter);
				mp.setSort(sde.index);
				mp.setSwitchOnOff(SwitchEnum.ON.getCode());
				mp.setGridType(typeEnum.getId());
				st.add(mp);
			}
		}
		return st;
	}


	/** <p>{@link int int getIndex()*/
	public int getIndex() {
		return index;
	}
	/** <p>setIndex({@link int int index})*/
	public void setIndex(int index) {
		this.index = index;
	}
	/** <p>{@link String String getField()*/
	public String getField() {
		return field;
	}


	/** <p>setField({@link String String field})*/
	public void setField(String field) {
		this.field = field;
	}


	/** <p>{@link Integer Integer getWidth()*/
	public Integer getWidth() {
		return width;
	}


	/** <p>setWidth({@link Integer Integer width})*/
	public void setWidth(Integer width) {
		this.width = width;
	}


	/** <p>{@link String String getHalign()*/
	public String getHalign() {
		return halign;
	}


	/** <p>setHalign({@link String String halign})*/
	public void setHalign(String halign) {
		this.halign = halign;
	}


	/** <p>{@link String String getAlign()*/
	public String getAlign() {
		return align;
	}


	/** <p>setAlign({@link String String align})*/
	public void setAlign(String align) {
		this.align = align;
	}


	/** <p>{@link String String getSortable()*/
	public String getSortable() {
		return sortable;
	}


	/** <p>setSortable({@link String String sortable})*/
	public void setSortable(String sortable) {
		this.sortable = sortable;
	}

	/** <p>{@link String String getFormatter()*/
	public String getFormatter() {
		return formatter;
	}


	/** <p>setFormatter({@link String String formatter})*/
	public void setFormatter(String formatter) {
		this.formatter = formatter;
	}


	/** <p>{@link String String getText()*/
	public String getText() {
		return text;
	}


	/** <p>setText({@link String String text})*/
	public void setText(String text) {
		this.text = text;
	}
	
	
}
